<?php
	include_once 'isLogin.php';
	$adminc = new admin();
	
	if($_POST){
		$row = $adminc->getAdminInfo();	
		if(md5($_POST['oldpwd'])==$row['pwd']){
			$arr = array('pwd'=>md5($_POST['password']));
			$adminc->adminUpdate($arr,"id='".$_COOKIE['admin_id']."'");
			$code = "200";
			$msg = "密码修改成功";
		}else{
			$code = "300";
			$msg = "原密码输入错误，请重新输入";
		}
		echo $commonc->submitAlert($msg, 'setpwd.php');
		//echo $commonc->ajaxDone($msg,$code);
		exit();
	}
	
	$smarty->display("setpwd.html");
?>